package com.sword.erp.logistics.service.impl;

import com.sword.erp.logistics.service.LogisticsOverseasService;
import com.sword.erp.logistics.service.dto.LogisticsRequest;
import com.sword.erp.logistics.service.dto.LogisticsResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import java.time.Instant;

/**
 * 海外物流服务实现类
 * @author sword
 * @date 2021/11/1 11:11
 */
@Slf4j
@DubboService(version = "1.0", group = "LogisticsGroup", interfaceClass = LogisticsOverseasService.class)
public class LogisticsOverseasServiceImpl implements LogisticsOverseasService {
    @Override
    public LogisticsResponse createOverseasLogistics(LogisticsRequest logisticsRequest) {
        LogisticsResponse logisticsResponse = LogisticsResponse
                .builder()
                    .orderCode(logisticsRequest.getOrderCode())
                    .logisticsCode(Instant.now().toString())
                .build();

        log.info("订单号为{}的订单的物流单创建成功，单号为{}", logisticsResponse.getOrderCode(), logisticsResponse.getLogisticsCode());
        return logisticsResponse;
    }
}
